﻿<metro:Window xmlns:my="clr-namespace:Elysium.Theme.Controls.Primitives;assembly=Elysium.Theme"  x:Class="WiiLuvScumm.MainWindow"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"              
              xmlns:Controls="clr-namespace:WiiLuvScumm.Controls"
              xmlns:metro="http://schemas.codeplex.com/elysium/theme"
              xmlns:Controls1="clr-namespace:Controls;assembly=Controls"
              xmlns:Dialogs="clr-namespace:WiiLuvScumm.Dialogs" 
              Title="Wii Play Scumm"
              Height="500" Width="900"
              WindowStartupLocation="CenterScreen"
              WindowState="Maximized"
              >
    <metro:Window.ApplicationBar>
        
        <metro:ApplicationBar Padding="0,10"
                              Background="#DD000000">
            <metro:ApplicationBar.Resources>
                <Style TargetType="{x:Type metro:CommandButton}">
                    <Setter Property="Foreground" Value="#FFFFFF"/>
                    <Setter Property="FontSize" Value="28" />
                    <Setter Property="Margin" Value="10,3" />
                </Style>
            </metro:ApplicationBar.Resources>
            
            <!-- Right Click on the UI to open Application Bar -->



            <metro:CommandButton Header="Add a Game.."
                                         Command="{Binding AddGameCommand}"/>

            <metro:CommandButton  Header="Setup WiiMote.."/>

            <metro:CommandButton  Header="Setup GlovePie / ScummVM.." 
                                  Command="{Binding ShowSettingsCommand}"/>

        </metro:ApplicationBar>
       
    </metro:Window.ApplicationBar>

   
    
    <Grid Margin="15">
        <Grid.RowDefinitions>
            <RowDefinition Height="3*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>


        <ItemsControl ItemsSource="{Binding Games}"
                      x:Name="GameWrapPanel">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Margin="20"
                            Width="300"
                            Command="{Binding DataContext.StartGameCommand, ElementName=GameWrapPanel}"
                            CommandParameter="{Binding}">
                    <StackPanel>
                        <Image Source="{Binding Image}"
                                       />
                        <Separator Margin="0,4" />
                        <TextBlock Text="{Binding Name}"
                                   FontFamily="Segoe UI" 
                                   FontSize="20"
                                   TextAlignment="Center"/>

                    </StackPanel>
                    </Button>
                    <!--<Controls1:GameTile Game="{Binding}" 
                                        Margin="20"
                                        Width="200"
                                        Height="100"
                                        Command="{Binding DataContext.StartGameCommand, ElementName=GameWrapPanel}"
                                        CommandParameter="{Binding}"
                                        />-->
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            
        </ItemsControl>          


        <!--</WrapPanel>-->
        
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="180" />
                <ColumnDefinition Width="180" />
                <ColumnDefinition Width="180" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            
            <Controls:SettingsTile >
                <Image Source="pack://application:,,,/Assets;component/Media/wiimote.png" />
            </Controls:SettingsTile>



        </Grid>



        <Dialogs:AddGamesDialog Grid.RowSpan="2"
                               Visibility="{Binding AddGameDialogVisibility}"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               
                               />
        <Dialogs:SettingsDialog Grid.RowSpan="2"
                               Visibility="{Binding SettingsDialogVisibility}"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               
                               />
    </Grid>
</metro:Window>
